<?php
	class libraries_order extends database{
		protected $_table = "tbl_order";
		public function update_order($data,$id){
			foreach($data as $k => $v){
				$arr[] = "$k = '$v'";
			}
			$col = implode(",",$arr);
			$sql = "update $this->_table set $col where contact_id = '1'";
			$this->query($sql);
		}
		public function update_status($data,$id){
			foreach($data as $k => $v){
				$arr[] = "$k = '$v'";
			}
			$col = implode(",",$arr);
			$sql = "update $this->_table set $col where id = '$id'";
			$this->query($sql);
		}
		public function getdata($id){
			$sql = "select * from $this->_table";
			$this->query($sql);
			return $this->fetch();
		}
		public function total_order(){
			$sql = "select * from $this->_table";
			$this->query($sql);
			return $this->num_rows();
		}
		public function list_order($start,$limit){
			$sql = "select * from $this->_table order by id DESC limit $start,$limit";
			$this->query($sql);
			return $this->fetchAll();
		}
		public function del_order($table,$id){
			$sql = "delete from $this->_table where id = '$id'";
			$this->query($sql);
		}
		public function get_order($id){
			$sql = "select *from $this->_table where id = '$id'";
			$this->query($sql);
			return $this->fetch();
		}
	}
?>